package com.example.interview.no0104.solution;

import com.example.interview.no0104.Solution;

/**
 * @Description 解答-回文排列
 * @ClassName ArraySolution
 * @Author Administrator
 * @Date 2020/7/7 19:36
 * @Version 1.0.0
 */
public class CharArraySolution implements Solution {
    @Override
    public boolean canPermutePalindrome(String s) {
        int [] index = new int[128];
        int res = 0;
        for (int i = 0; i < s.length(); i++) {
            index[s.charAt(i)]++;
        }
        for (int i = 0; i < 128; i++) {
            if (index[i] % 2 != 0) {
                ++res;
            }
        }
        return res <= 1 ? true:false;
    }
}
